package org.emmannuel.virtues.server;

import java.util.ArrayList;

import org.emmannuel.virtues.client.Requester;
import org.emmannuel.virtues.client.common.TOSuggestion;
import org.emmannuel.virtues.client.common.TOVirtue;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;

/**
 * The server side implementation of the RPC service.
 */
@SuppressWarnings("serial")
public class RequesterImpl extends RemoteServiceServlet implements Requester {

	DataBaseMock dbMock = new DataBaseMock();
	
	public String greetServer(String input) {
		String serverInfo = getServletContext().getServerInfo();
		String userAgent = getThreadLocalRequest().getHeader("User-Agent");
		return "Hello, " + input + "!<br><br>I am running " + serverInfo
				+ ".<br><br>It looks like you are using:<br>" + userAgent;
	}
	
	public ArrayList<TOVirtue> showVirtues(){
		return dbMock.generateVirtues();		
	}

	public Boolean adoptVirtue(Integer id, int user) {
		// TODO Auto-generated method stub
		return null;
	}

	public ArrayList<TOSuggestion> getVirtueSuggestion(int virtueId) {
		return dbMock.generateSuggestion(virtueId);
	}

	@Override
	public Boolean register(String capcha, String eMail, String name,
			String pass) {
		// TODO Auto-generated method stub
		return null;
	}
}
